import React, { useState, useEffect } from 'react';

import { useDeepCompareEffect } from 'ahooks';

export default function(props){
  const [state, setState] = useState({a: 1, b:2,c: {d:{e:99}}})

  useEffect(() => {
    console.log(state)
  }, [state])

//   useDeepCompareEffect(() => {
//    console.log("---", state)
//     return () => {
//       // do something
//     };
//   }, [state]);

  return (
    <div>
        ----
        <button onClick={() => {
            let a = state

            setState( (a) => {
                console.log(a)
                let b = a
                b.c.d.e = '000'
                return b
            } )
        }} > 00 </button>
    </div>
  )
}